package com.ruoyi;

import com.huifu.adapay.Adapay;
import com.huifu.adapay.model.MerConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

/**
 * 启动程序
 *
 * @author ruoyi
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@ComponentScan({ "com.ruoyi.*", "com.jiuyou.*" })
public class RuoYiApplication
{
    public static void main(String[] args)
    {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(RuoYiApplication.class, args);

        /**
         * debug 模式，开启后有详细的日志
         */
        Adapay.debug = false;

    /**
     * prodMode 模式，默认为生产模式，false可以使用mock模式
     */
        Adapay.prodMode = true;

    /**
     * 初始化商户配置，服务器启动前，必须通过该方式初始化商户配置完成
     * apiKey为prod模式的API KEY
     * mockApiKey为mock模式的API KEY
     * rsaPrivateKey为商户发起请求时，用于请求参数加签所需要的RSA私钥
     */
        String apiKey = "api_live_010e0c37-3885-4db0-a729-c45da06db802";
        String mockApiKey = "api_test_a689ca60-9930-4cdb-9b37-3ff47204899a";
        String rsaPrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJ8gKi7ehLxNsX8Y+XYvhu0FH5Yyrj5RRHqQQuWEs9cW8HKFJ1N4sFG2UgIDU4Z7YdB55mrt/QHlIR4MHAXL9ZdsvpEiR6NMpj1VbJOc3X0ZWNhuaswhFLYHIHJ46HlOvPyzV9ls3FifPlkCd0H1yzyZ4pUuAstVKQXxBem8ml1NAgMBAAECgYAlFVDfVVonrA+GaCKSyWavS/ddgHgc68GCsqX0aSWkJaNpfOB6UnD8yfl4oJ/RgmV8OTxahRXmYCiEoRvSugKEpl+Mbz16uQisB3mw/CKw+I6iPuS86qE70NvfroCr3ye+QiuU0az04nNxYKwbA7Sm3OsIZ3RZGyAysmx2Tm/xwQJBANFJ45F+ykhARhX0MvnNeZg+6YPSfOwBm2Jjc8GKAuX9cJubnci3I4vteXqfQPgK0wqpNX0xEfSwDiXINhM8hn0CQQDCpB3WnWb6uGGugPfuHBSL8+NCG4oIzgFZRBWfguVfuF3IJ2PdX4uKr8Nz+SFLQ0tP3fNaLsIm6HgX9MsYk1sRAkBR6Jogyj9+sXD8jJsauvkYxZ58kfeEIkje489c8peZzWux6uCAunQ2AlXl0MgLi6j25ixh979wRSr0THwlYS29AkEAweVHrDIlEgJ3nKTxVww2E60jaQmSGm9NvKUsfTiiUxaQpgFHZJH3qnKpXHCDkDw7XBaYg/AsjSHr8MF1SMgSYQJASirR0eGcIIEsBsPSV7N8OicISy30epe/CbW437ADY/IfhQhGXymar/aVEZwE29yLHxvc3KJYimkhf3CMdpSlKg==";

        MerConfig merConfig = new MerConfig();
        merConfig.setApiKey(apiKey);
        merConfig.setApiMockKey(mockApiKey);
        merConfig.setRSAPrivateKey(rsaPrivateKey);

        try {
            Adapay.initWithMerConfig(merConfig);
            System.out.println("支付启动成功\n" );
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("支付启动异常\n" );
        }
        System.out.println("系统启动成功,请正常使用     \n" );

    }
}
